package com.xinhua.erp.controller;

import com.xinhua.erp.pojo.Result;
import com.xinhua.erp.pojo.Retail;
import com.xinhua.erp.pojo.Role;
import com.xinhua.erp.repo.RoleRepo;
import com.xinhua.erp.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName RoleController
 * @Description TODO
 * @Date 2019/12/26 下午11:20
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    @GetMapping("{id}")
    public Result findById(@PathVariable long id) {
        return roleService.findById(id);
    }

    @DeleteMapping("{id}")
    public Result deleteById(@PathVariable long id) {
        return roleService.deleteById(id);
    }

    @PostMapping
    public Result save(@RequestBody Role role) {
        return roleService.save(role);
    }

    @PutMapping
    public Result update(@RequestBody Role role) {
        return roleService.update(role);
    }

}
